package com.puccampinas.finalproject.core.persistence.entity;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.puccampinas.finalproject.core.persistence.entity.enums.StepType;

@XmlType(name = "step")
@XmlRootElement(name = "step")
@XmlAccessorType(XmlAccessType.FIELD)
public class Step implements Serializable, Comparable<Step> {

	private static final long serialVersionUID = 1871293872L;
	@XmlElement(name = "order")
	private Integer order;
	
	@XmlElement(name = "description")
	private String description;
	
	@XmlElement(name = "answer")
	private String answer;
	
	@XmlElement(name = "type")
	private StepType type;
	
	public Integer getOrder() {
		return order;
	}
	public void setOrder(Integer order) {
		this.order = order;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getAnswer() {
		return answer;
	}
	public void setAnswer(String answer) {
		this.answer = answer;
	}
	public StepType getType() {
		return type;
	}
	public void setType(StepType type) {
		this.type = type;
	}

	@Override
	public int compareTo(Step o) {
		if (o.getOrder() < this.order) {
			return 1;
		} else if (o.getOrder() > this.order) {
			return -1;
		}
		return 0;
	}
	
}
